﻿// ==========================================================================
// CustomShape.cs
// Silverlight Shapes Library
// ==========================================================================
// Copyright (c) Silverlight Shapes Development Group
// All rights reserved.
// ==========================================================================

using System.Windows.Interactivity;
using SD.Shapes.Common;
using SD.Shapes.Common.Interactivity;
using SD.Shapes.Templates.Basic;
using SD.Utils.Windows.Interactivity;

namespace SD.Shapes.Samples.CustomNode
{
    /// <summary>
    /// Defines a custom shape. This control dervices from node base class. Handling user interaction 
    /// is done by adding behaviors and adorners to the shape.
    /// </summary>
    public class MyNode : NodeBase
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MyNode"/> class.
        /// </summary>
        public MyNode()
        {
            DefaultStyleKey = typeof(MyNode);

            BehaviorCollection behaviors = Interactions.GetBehaviors(this);
            behaviors.Add(new ShapeSelectionBehavior());
            behaviors.Add(new ShapeBaseMovementBehavior());
            behaviors.Add(new NodeBaseConnectorLinkBehavior<BasicConnection>());

            AdornerCollection adorners = Interactions.GetAdorners(this);
            adorners.Add(new NodeBaseRotationAdorner());
            adorners.Add(new NodeBaseScalingAdorner());
            adorners.Add(new TextEditorAdorner());
            adorners.Add(new AutoConnectAdorner());
        }
    }
}
